/* 全局样式 */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  width: 100%;
}

#root {
  height: 100%;
  width: 100%;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--ant-color-bg-layout, #f1f1f1);
}

::-webkit-scrollbar-thumb {
  background: var(--ant-color-text-secondary, #c8c8c8);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ant-color-text-primary, #a8a8a8);
}

/* 暗色模式下的滚动条样式 */
.dark-mode ::-webkit-scrollbar-track {
  background: var(--ant-color-bg-layout);
}

.dark-mode ::-webkit-scrollbar-thumb {
  background: var(--ant-color-text-secondary);
  opacity: 0.3;
}

.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: var(--ant-color-text-secondary);
  opacity: 0.5;
}

/* TopMenu 样式 */
.top-menu-red {
  float: right;
  z-index: 1000;
  position: sticky;
  top: 16px;
  background: #fff;
  padding: 8px 16px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dark-mode .top-menu-red {
  background: var(--ant-color-bg-elevated);
  box-shadow: none;
}

/* 应用头部基础样式 */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 60px;
  background-color: var(--ant-color-bg-layout, #fff);
  border-bottom: 1px solid var(--ant-color-border, #f0f0f0);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 应用侧边栏基础样式 */
.app-sidebar {
  background-color: var(--ant-color-bg-layout, #fff);
  border-right: 1px solid var(--ant-color-border, #f0f0f0);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  margin: 0;
  padding: 0;
}

/* 侧边栏样式 - Ant Design 官方推荐 */
.ant-layout-sider {
  /* 确保sider使用固定定位 */
  position: fixed;
  top: 0;
  left: 0;
  background: var(--ant-color-bg-layout);
  height: 100vh;
}

.ant-layout-sider-children {
  /* 调整内部内容区域，确保它可以独立滚动 */
  height: 100%;
  overflow-y: auto;
  margin-right: 0;
  padding-right: 0;
  padding-right: 8px;
  margin: 0;
  padding: 0;
}

/* 侧边栏菜单样式 */
.sidebar-menu {
  border-right: 0;
  height: 100%;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

/* 菜单项样式优化 */
.sidebar-menu .ant-menu-item {
  transition: all 0.3s;
}

.sidebar-menu .ant-menu-submenu-title {
  transition: all 0.3s;
}

/* 确保菜单项在暗色模式下显示正确 */
.dark-mode .ant-menu-inline {
  background: transparent;
}

/* 侧边栏底部区域 */
.app-sidebar-bottom {
  border-top: 1px solid var(--ant-color-border, #f0f0f0);
  margin-top: auto;
  background-color: var(--ant-color-bg-layout, #fff);
  margin-bottom: 0;
  margin-left: 0;
  margin-right: 0;
  padding: 0;
}

/* 侧边栏内部收缩按钮 */
.sidebar-collapse-btn-inner {
  transition: all 0.3s ease;
}

.sidebar-collapse-btn-inner:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

/* 侧边栏收缩按钮 */
.sidebar-collapse-btn {
  position: fixed;
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ant-color-bg-elevated, #fff);
  border: 1px solid var(--ant-color-border, #f0f0f0);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: left 0.3s ease, all 0.3s;
  z-index: 10;
}

.sidebar-collapse-btn:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 全局过渡效果 */
.app-header, .app-sidebar, .app-sidebar-bottom, .sidebar-collapse-btn {
  transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* 暗色模式样式优化 */
.dark-mode .app-header {
  background-color: var(--ant-color-bg-layout);
  border-bottom-color: var(--ant-color-border);
  box-shadow: none;
}

.dark-mode .app-sidebar {
  background-color: var(--ant-color-bg-layout);
  border-right-color: var(--ant-color-border);
  position: fixed;
}

.dark-mode .app-sidebar-bottom {
  border-top-color: var(--ant-color-border);
  background-color: var(--ant-color-bg-layout);
}

.dark-mode .sidebar-collapse-btn {
  background: var(--ant-color-bg-elevated);
  border-color: var(--ant-color-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark-mode .sidebar-collapse-btn:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border-color: var(--ant-color-primary);
}

.dark-mode .sidebar-collapse-btn-inner {
  background-color: var(--ant-color-bg-elevated);
  border-color: var(--ant-color-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  color: var(--ant-color-text-secondary);
}

.dark-mode .sidebar-collapse-btn-inner:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
  transform: scale(1.1);
  color: var(--ant-color-primary);
}

/* 暗色模式下的侧边栏菜单项样式优化 */
.dark-mode .sidebar-menu .ant-menu-item,
.dark-mode .sidebar-menu .ant-menu-submenu-title {
  color: var(--ant-color-text-secondary);
}

.dark-mode .sidebar-menu .ant-menu-item:hover,
.dark-mode .sidebar-menu .ant-menu-submenu-title:hover {
  color: var(--ant-color-primary);
  background-color: rgba(255, 255, 255, 0.04);
}

.dark-mode .sidebar-menu .ant-menu-item.ant-menu-item-selected {
  color: var(--ant-color-primary);
  background-color: rgba(45, 140, 240, 0.15);
}
